<@_content id=id>
    <#assign a=object/>
    <#assign id=a.id/>
    <#assign parentId=a.parentId!/>
    <#assign categoryId=a.categoryId!/>
    <#assign modelId=a.modelId!/>
    <#assign attribute=getContentAttribute(a.id)!/>
</@_content>
<@_category id=categoryId!><#assign category=object/></@_category>
<@_model id=modelId!><#assign model=object/></@_model>
<script>
function clickAddTag(){
    $('.tags .button',navTab.getCurrentPanel()).click();
}
</script>
<form method="post" action="cmsContent/save.do?callbackType=closeCurrent&navTabId=cmsContent/list" class="pageForm required-validate" onsubmit="clickAddTag(); return validateCallback(this,navTabAjaxDone);">
    <input name="id" type="hidden" value="${id!}" />
    <input name="parentId" type="hidden" value="${parentId!}" />
    <input type="hidden" name="_csrf" value="<@_csrfToken admin=true/>"/>
    <div class="formBar">
        <ul>
            <li>
                <label><input type="checkbox" name="draft"/><@t.page 'draft'/></label>
            </li>
            <@_sysAuthorized roleIds=admin.roles url='cmsContent/check'>
                <li>
                    <label>
                        <input type="checkbox" name="checked" onclick="if($(this).is(':checked')){$('input[name=draft]',navTab.getCurrentPanel()).parent().parent().hide();}else{$('input[name=draft]',navTab.getCurrentPanel()).parent().parent().show();}"/>
                        <@t.page 'check_passed'/>
                    </label>
                </li>
            <#if a?has_content&&1=a.status><script>$('input[name=checked]',navTab.getCurrentPanel()).click();</script></#if>
            </@_sysAuthorized>
            <li><button type="submit" class="buttonActive"><@t.page 'button.save'/></button></li>
            <li><button type="button" class="button close"><@t.page 'button.close'/></button></li>
        </ul>
    </div>
    <div class="tabs">
        <div class="tabsHeader">
            <div class="tabsHeaderContent">
                <ul>
                    <li><a href="javascript:;" onclick="return false;"><@t.page 'base_info'/></a></li>
                    <li><a href="javascript:;" onclick="return false;"><@t.page 'recommend_info'/></a></li>
                </ul>
            </div>
        </div>
        <div class="tabsContent unitBox">
            <div class="pageFormContent" layoutH="96">
        <#if model?has_content>
            <#assign fieldList=model.fieldList![]/>
            <#assign requiredFieldList=model.requiredFieldList![]/>
            <@_content id=parentId>
                <dl class="nowrap">
                    <dt><@t.page 'content.parent'/>:</dt>
                    <dd>
                        ${(object.title)!}
                    </dd>
                </dl>
            </@_content>
            <dl>
                <dt><@t.page 'category'/>:</dt>
                <dd>
                    <input name="categoryId" type="hidden" value="${categoryId!}"/>
                    ${(category.name)!}
                </dd>
            </dl>
            <dl>
                <dt><@t.page 'model'/>:</dt>
                <dd>
                    <input name="modelId" type="hidden" value="${modelId!}"/>
                    ${(model.name)!}
                </dd>
             </dl>
              <dl class="nowrap">
                <dt>${(model.fieldTextMap['title'])!}:</dt>
                <dd>
                    <input class="required" name="title" type="text" maxlength="250" size="60" value="${(a.title)!}"/>
            <#if fieldList?seq_contains('copied')>
                    <label><input name="copied" type="checkbox"/>${(model.fieldTextMap['copied'])!}</label>
<script>
$('input[name=copied]',navTab.getCurrentPanel()).click(function(){
    if($(this).is(':checked')) {
        $('.copied',navTab.getCurrentPanel()).show();
        $('.copied input[type=text]',navTab.getCurrentPanel()).addClass('required');
    } else {
        $('.copied',navTab.getCurrentPanel()).hide();
        $('.copied input[type=text]',navTab.getCurrentPanel()).removeClass('required').val('');
    }
});
</script>
            </#if>
                    </dd>
                </dl>
                <dl class="copied" style="display:none">
                    <dt>${(model.fieldTextMap['source'])!}:</dt>
                    <dd><input name="source" type="text" maxlength="50" size="20" value="${(attribute.source)!}"/></dd>
                </dl>
                <dl class="copied" style="display:none">
                    <dt>${(model.fieldTextMap['sourceUrl'])!}:</dt>
                    <dd><input class="url" name="sourceUrl" type="text" maxlength="250" size="20" value="${(attribute.sourceUrl)!}"/></dd>
                </dl>
            <#if a?has_content&&a.copied&&fieldList?seq_contains('copied')>
<script>
$('input[name=copied]',navTab.getCurrentPanel()).click();
</script>
            </#if>
            <#if model.onlyUrl>
                <dl class="nowrap">
                    <dt>${(model.fieldTextMap['url'])!}:</dt>
                    <dd>
                        <input name="url" type="text" maxlength="1000" size="60" value="${(a.url)!}"/>
                    </dd>
                </dl>
            </#if>
            <#if fieldList?seq_contains('tag')>
                 <#include "../include_page/tags.html"/>
                 <#assign tagTypeIds=category.tagTypeIds!''/>
                 <#assign tagIds=(a.tagIds)!''/>
                 <#assign tagText=(model.fieldTextMap['tag'])!''/>
                 <@tags tagText tagTypeIds tagIds/>
            </#if>
            <#if fieldList?seq_contains('author')>
                <dl>
                    <dt>${(model.fieldTextMap['author'])!}:</dt>
                    <dd><input name="author"<#if requiredFieldList?seq_contains('author')> class="required"</#if> type="text" maxlength="50" size="20" value="${(a.author)!}"/></dd>
                </dl>
            </#if>
            <#if fieldList?seq_contains('editor')>
                <dl>
                    <dt>${(model.fieldTextMap['editor'])!}:</dt>
                    <dd><input name="editor"<#if requiredFieldList?seq_contains('editor')> class="required"</#if> type="text" maxlength="50" size="20" value="${(a.editor)!}"/></dd>
                </dl>
            </#if>
            <#if fieldList?seq_contains('description')>
                <dl class="nowrap">
                    <dt>${(model.fieldTextMap['description'])!}:</dt>
                    <dd>
                        <textarea name="description"<#if requiredFieldList?seq_contains('description')> class="required"</#if> maxlength="280" cols="80" rows="4">${(a.description)!}</textarea>
                    </dd>
                </dl>
            </#if>
                <dl>
                    <dt><@t.page 'content.timming'/>:</dt>
                    <dd>
                      <input name="timing" type="checkbox" onclick="if($(this).is(':checked')){$('#publishDate',navTab.getCurrentPanel()).show();$('input[name=publishDate]',navTab.getCurrentPanel()).addClass('required').addClass('valid')}else{$('#publishDate',navTab.getCurrentPanel()).hide();$('input[name=publishDate]',navTab.getCurrentPanel()).removeClass('required').removeClass('valid')}"/>
                    </dd>
                </dl>
                <dl id="publishDate" style="display:none">
                    <dt><@t.page 'publish_date'/>:</dt>
                    <dd>
                        <input type="text" name="publishDate" class="date" size="20" dateFmt="yyyy-MM-dd HH:mm:ss" value="${(a.publishDate)!}"/>
                        <a class="inputDateButton" href="javascript:;" onclick="return false;"></a>
                    </dd>
                </dl>
            <#if a?has_content&&a.publishDate gt .now>
<script>
$('input[name=timing]',navTab.getCurrentPanel()).click();
</script>
            </#if>
            <#if fieldList?seq_contains('cover')>
                <dl class="nowrap">
                    <dt>${(model.fieldTextMap['cover'])!}:</dt>
                    <dd>
                        <input name="cover"<#if requiredFieldList?seq_contains('cover')> class="required"</#if> value="${(a.cover)!}" maxlength="300" size="50" type="text"/>
                        <a class="btnAttach" href="common/upload.html?field=cover&onlyImage=true" lookupGroup="" width="560" height="300">${(model.fieldTextMap['cover'])!}</a>
                        <#include "../include_page/preview.html"/>
                        <@preview 'content' 'input[name=cover]'/>
                    </dd>
                </dl>
            </#if>
            <#include "../include_page/extendData.html"/>
            <#if category?has_content&&category.extendId?has_content>
                 <@_sysExtendFieldList extendId=category.extendId>
                    <#assign extendList=list![]/>
                    <#assign extendValue=attribute!{}/>
                    <@extendData 'categoryExtendDataList' extendList extendValue/>
                 </@_sysExtendFieldList>
            </#if>
            <#assign extendList=model.extendList![]/>
            <#assign extendValue=attribute!{}/>
            <@extendData 'modelExtendDataList' extendList extendValue/>
            <#if fieldList?seq_contains('content')>
                <dl class="nowrap">
                    <dt>${(model.fieldTextMap['content'])!}:</dt>
                    <dd style="width:90%">
                        <textarea name="text" class="editor<#if requiredFieldList?seq_contains('content')> required</#if>" editorType="${model.editorType!}">${(attribute.text)!}</textarea>
                    </dd>
                </dl>
            </#if>
            <#if model.hasImages||model.hasFiles>
                <#include "../include_page/contentFiles.html"/>
                <#if model.hasImages>
                    <@contentFiles true id!/>
                </#if>
                <#if model.hasFiles>
                    <@contentFiles false id!/>
                </#if>
            </#if>
        </#if>
            </div>
            <div class="pageFormContent" layoutH="96">
				<table class="list nowrap itemDetail" addButton="<@t.page 'button.new_line'/>" width="100%">
				    <thead>
				        <tr>
				            <th type="lookup" name="contentRelateds[#index#].title" size="30" fieldClass="required" fieldAttrs="{maxlength:255,width:1080,height:500}" lookupGroup="contentRelateds[#index#]" lookupUrl="cmsContent/lookup.html" lookupPk="relatedContentId"><@t.page 'content.select'/></th>
				            <th type="text" name="contentRelateds[#index#].url" size="40" fieldClass="required" fieldAttrs="{maxlength:2048}"><@t.page 'address'/></th>
				            <th type="textarea" name="contentRelateds[#index#].description" fieldAttrs="{maxlength:300,rows:2,cols:60}"><@t.page 'description'/></th>
				            <th type="text" name="contentRelateds[#index#].sort" fieldClass="required digits" defaultval="#index#" size="5"><@t.page 'sort'/></th>
				            <th type="del" width="60"><@t.page 'operate'/></th>
				        </tr>
				    </thead>
				    <tbody>
				<#if id?has_content>
				    <@_contentRelatedList contentId=id>
				        <#list page.list as related>
				            <tr>
				                <td>
				                    <input type="hidden" name="contentRelateds[${related?index}].id" value="${related.id}"/>
				                    <input type="hidden" name="contentRelateds[${related?index}].relatedContentId" value="${related.relatedContentId!}"/>
				                    <input class="required" type="text" name="contentRelateds[${related?index}].title" value="${related.title}" size="30" maxlength="255" class="required" />
				                    <a class="btnLook" href="cmsContent/lookup.html" lookupGroup="contentRelateds[${related?index}]" lookupPk="relatedContentId" width="1080" height="500"><@t.page 'content.select'/></a>
				                </td>
				                <td>
				                    <input class="required" type="text" name="contentRelateds[${related?index}].url" value="${(related.url)!}" size="40" maxlength="2048"/>
				                </td>
				                <td>
				                    <textarea name="contentRelateds[${related?index}].description" rows="2" cols="60" maxlength="300">${(related.description)!}</textarea>
				                </td>
				                <td>
				                    <input class="required digits" type="text" name="contentRelateds[${related?index}].sort" value="${related.sort!}" size="5" maxlength="5"/>
				                </td>
				                <td>
				                    <a href="javascript:void(0)" class="btnDel"><@t.page 'button.delete'/></a>
				                </td>
				            </tr>
				        </#list>
				    </@_contentRelatedList>
				</#if>
				    </tbody>
				</table>
            </div>
        </div>
    </div>
</form>